package com.deer.remote.server.rds.controller;

import com.deer.remote.common.protocol.Message;
import com.deer.remote.common.protocol.Packet;
import com.deer.remote.server.rds.BaseMessageController;
import com.deer.remote.server.rds.TentacleDesktopSession;

/**
 * Created by matrixy on 2019/1/4. 受控端获取剪贴板内容的回应
 */
public class GetClipboardResponseController extends BaseMessageController {
	@Override
	public boolean authenticateRequired() {
		return true;
	}

	@Override
	public Message service(TentacleDesktopSession session, Message msg) throws Exception {
		Packet packet = msg.getBody();
		int len = packet.nextInt();
		String text = new String(packet.nextBytes(len), "UTF-8");
		session.getWebsocketContext().sendClipboardData(text);

		return null;
	}
}
